#ifndef T13_H
#define T13_H

#include "common.h"

template <AllegroVersion version>
struct t13
{
    uint32_t str_ptr; // Often null
    uint32_t t;
    
    
    int32_t w;
    int32_t h;
    int32_t x2;
    int32_t x3;
    
    // This should be _after_ `x4`, but conditional fields at the end of
    // the struct are flakey?
    
    int32_t x4;
    
    operator t13<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};

#if __cplusplus >= 202002L
template <AllegroVersion version> requires(version >= A_172)
struct t13<version>
{
    uint32_t str_ptr; // Often null
    uint32_t t;

    uint32_t z0;

    int32_t w;
    int32_t h;
    int32_t x2;
    int32_t x3;

    // This should be _after_ `x4`, but conditional fields at the end of
    // the struct are flakey?
    uint32_t z;

    int32_t x4;

    operator t13<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};
#else
template <>
struct t13<A_172>
{
    uint32_t str_ptr; // Often null
    uint32_t t;

    uint32_t z0;

    int32_t w;
    int32_t h;
    int32_t x2;
    int32_t x3;

    // This should be _after_ `x4`, but conditional fields at the end of
    // the struct are flakey?
    uint32_t z;

    int32_t x4;

    operator t13<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};

template <> struct t13<A_174> : t13<A_172> {};
#endif

static_assert(sizeof(t13<A_160>) == 28);
static_assert(sizeof(t13<A_174>) == 36);

#endif // T13_H
